<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<title>Static Master/Detail Pattern -- Multiple Address Detail example</title>
		<style type="text/css">
			@import "css/app-format.css";
			@import "../../../dijit/themes/claro/claro.css";
		</style>
		<script type="text/javascript">
			require = {
				parseOnLoad: 0,
				isDebug: 1,
				async: 1, 
				mvc: {debugBindings: 1}
			};
		</script>
		<script type="text/javascript" src="../../../dojo/dojo.js"></script>
		<script type="text/javascript">
			require([
				"dojo/parser",
				"dojox/mvc/getStateful",
				"dojox/mvc/ListController",
				"dijit/form/Button",
				"dijit/form/TextBox",
				"dojox/mvc/Group",
				"dojox/mvc/Repeat",
				"dojo/domReady!"
			], function(parser, getStateful, ListController){
				ctrl = new ListController({
					model: getStateful([
						{
							First: "Anne",
							Last: "Ackerman",
							Location: "NY",
							Office: "1S76",
							Email: "a.a@test.com",
							Tel: "123-764-8237",
							Fax: "123-764-8228"
						},
						{
							First: "Ben",
							Last: "Beckham",
							Location: "NY",
							Office: "5N47",
							Email: "b.b@test.com",
							Tel: "123-764-8599",
							Fax: "123-764-8600"
						},
						{
							First: "Chad",
							Last: "Chapman",
							Location: "CA",
							Office: "1278",
							Email: "c.c@test.com",
							Tel: "408-764-8237",
							Fax: "408-764-8228"
						},
						{
							First: "Irene",
							Last: "Ira",
							Location: "NJ",
							Office: "F09",
							Email: "i.i@test.com",
							Tel: "514-764-6532",
							Fax: "514-764-7300"
						},
						{
							First: "John",
							Last: "Jacklin",
							Location: "CA",
							Office: "6701",
							Email: "j.j@test.com",
							Tel: "408-764-1234",
							Fax: "408-764-4321"
						}
					]),
					cursorIndex: 0
				});

				parser.parse();
			});
		</script>
	</head>
	<body class="claro" style="background-image: url(images/master_detail.png)">
		<script type="dojo/require">at: "dojox/mvc/at"</script>
		<div id="wrapper">
			<div id="header">
				<div id="navigation"></div>
				<div id="headerInsert">
					<h1>Master Detail Example - With repeat container</h1>
				</div>
			</div>
			<div id="main">
				<div id="leftNav"></div>
				<div id="mainContent">
					<div data-dojo-type="dojox.mvc.Repeat" data-dojo-props="children: at(ctrl, 'model')">
						<div>
							<label class="cell" for="nameInput${this.index}">Name:</label>
							<input class="cell" data-dojo-type="dijit.form.TextBox" id="nameInput${this.index}" data-dojo-props="value: at('rel:${index}', 'First')">
							<button type="button" data-dojo-type="dijit.form.Button"
							 data-dojo-props="onClick: function(){ ctrl.set('cursorIndex', ${this.index}); }">Details</button>
						</div>
					</div>
					<div class="spacer"></div>
					<div id="detailsBanner">
						Details for result index:
						<span data-dojo-type="dijit._WidgetBase"
						 data-dojo-props="_setValueAttr: {node: 'domNode', type: 'innerText'}, value: at(ctrl, 'cursorIndex')"></span>
					</div>
					<div id="detailsGroup" data-dojo-type="dojox.mvc.Group" data-dojo-props="target: at(ctrl, 'cursor')">
						<div class="row">
							<label class="cell" for="firstInput">First Name:</label>
							<input class="cell" id="firstInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'First')">
						</div>
						<div class="row">
							<label class="cell" for="lastInput">Last Name:</label>
							<input class="cell" id="lastInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Last')">
						</div>
						<div class="row">
							<label class="cell" for="officeInput">Office:</label>
							<input class="cell" id="officeInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Office')">
						</div>
						<div class="row">
							<label class="cell" for="emailInput">Email:</label>
							<input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Email')">
						</div>
						<div class="row">
							<label class="cell" for="telInput">Telephone:</label>
							<input class="cell" id="telInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Tel')">
						</div>
						<div class="row">
							<label class="cell" for="faxInput">Fax:</label>
							<input class="cell" id="faxInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Fax')">
						</div>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
